<template>
  <div>
    <div :style="{fontSize: postFontSize+'px'}">
      parent
      <input type="text" v-model="username" />
      <!--注册事件-->
      <Son :name="username" @enlarge-text="enlargeText" />
    </div>
  </div>
</template>

<script>
  import Son from './Son'
  export default {
    name: "Parent",
    data() {
      return {
        username: 'admin',
        postFontSize:10
      }
    },
    components:{
      Son
    },
    methods:{
      enlargeText(data){
        console.log(data);
        // 修改子组件传递的数据
        data.name = '李四'
        this.postFontSize++;
      }
    }
  }
</script>

<style scoped>
a{
  background-color: cornflowerblue;
}
</style>
